/**
 * Copyright 2010 Pavel Daniel Alexandru PFA
 * 
 * Licensed under the terms of the GNU Lesser General Public License version 3 
 * as published by the Free Software Foundation. You may obtain a copy of the
 * License at: http://www.gnu.org/copyleft/lesser.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations 
 * under the License. 
 */
package com.kobol.webclient.client.sales.view;

import com.kobol.webclient.client.model.AccountData;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.grid.ListGridField;

/**
 * @author Pavel Alexandru
 * 
 */
public class AccountsContextAreaListGrid extends SalesContextAreaListGrid {

    private static final String ICON = "icon";
    private static final String ACCOUNT_NAME = "accountName";
    private static final String MAIN_PHONE = "mainPhone";
    private static final String LOCATION = "location";
    private static final String PRIMARY_CONTACT = "primaryContact";
    private static final String EMAIL_PRIMARY_CONTACT = "emailPrimaryContact";

    public AccountsContextAreaListGrid() {
	super();

	// initialise the List Grid fields
	ListGridField iconField = new ListGridField(ICON, "#", 27);
	iconField.setImageSize(16);
	iconField.setAlign(Alignment.CENTER);
	iconField.setType(ListGridFieldType.IMAGE);
	iconField.setImageURLPrefix("icons/16/");
	iconField.setImageURLSuffix(".png");

	ListGridField accountNameField = new ListGridField(ACCOUNT_NAME, "Account Name", 140);
	ListGridField mainPhoneField = new ListGridField(MAIN_PHONE, "Main Phone", 90);
	ListGridField locationField = new ListGridField(LOCATION, "Location", 80);
	ListGridField primaryContactField = new ListGridField(PRIMARY_CONTACT, "Primary Contact", 100);
	primaryContactField.setType(ListGridFieldType.LINK);
	ListGridField emailPrimaryContactField = new ListGridField(EMAIL_PRIMARY_CONTACT, "Email (Primary Contact)",
		120);
	ListGridField emptyField = new ListGridField("emptyField", " ");

	// set the fields into the List Grid
	this.setFields(new ListGridField[] { iconField, accountNameField, mainPhoneField, locationField,
		primaryContactField, emailPrimaryContactField, emptyField });

	// populate the List Grid
	this.setData(AccountData.getRecords());
    }
}
